home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / RenShadersMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.8 KB  |  172 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  13 April 1997
  22. //
  23. //  Procedure Name:
  24. //      RenShadersMenu
  25. //
  26. //  Description:
  27. //        Create the RENDERING->Shaders menu
  28. //
  29. //  Input Arguments:
  30. //      parent to parent the menu to.
  31. //
  32. //  Return Value:
  33. //      None.
  34. //
  35.  
  36.  
  37. //  Procedure Name:
  38. //      buildShadingGroupMenu
  39. //
  40. //  Description:
  41. //      Procedure to build the shading group assign menu.
  42. //
  43. global proc buildShadingGroupMenu( string $parent )
  44. {
  45.     setParent -m $parent;
  46.     menu -e -dai $parent;
  47.  
  48.     string $sets[] = `ls -sets`;
  49.     for ( $set in $sets ) {
  50.         if (`sets -q -renderable $set`) {
  51.             menuItem -l $set 
  52.                 -annotation ("Assign Shading Group " + $set + ": Select surfaces / polygons")
  53.                 -c ( "assignShadingGroup " + $set );
  54.             menuItem -ob true 
  55.                 -annotation ($set + " Option Box")
  56.                 -l ($set + " Option Box")
  57.                 -c ( "showEditor " + $set );
  58.         }
  59.     }
  60. }
  61.  
  62. global proc refreshShadingMenu( string $parent )
  63. {
  64.     setParent -m $parent;
  65.  
  66.     string $activeList[] = `selectionConnection -query -object activeList`;
  67.     
  68.     if (size($activeList) == 1)
  69.     {
  70.         menuItem -edit -enable true
  71.             RenLightingSelectObjectsItem;
  72.         menuItem  -edit -enable true
  73.             RenLightingSelectLightsItem;
  74.     }
  75.     else
  76.     {
  77.         menuItem -edit -enable false
  78.             RenLightingSelectObjectsItem;
  79.         menuItem -edit -enable false
  80.             RenLightingSelectLightsItem;
  81.     }
  82.  
  83.     int $mentalIsLoaded = 0;
  84.     string $renderer;
  85.     for ($renderer in `renderer -query -namesOfAvailableRenderers`) {
  86.         if( $renderer == "mentalRay" ) {
  87.             $mentalIsLoaded = 1;
  88.             break;
  89.         }
  90.     }
  91.     menuItem -edit -enable $mentalIsLoaded assignNewBakeSetItem;
  92.     menuItem -edit -enable $mentalIsLoaded assignExistingBakeSetItem;
  93.     menuItem -edit -enable $mentalIsLoaded batchBakeItem;
  94.     menuItem -edit -enable $mentalIsLoaded batchBakeOptionsItem;
  95. }
  96.  
  97. global proc RenShadersMenu( string $parent )
  98. {
  99.     setParent -m $parent;
  100.     if( `menu -q -ni $parent` != 0 ) {
  101.         //
  102.         //    Menu is built already, just refresh it. 
  103.         //
  104.         refreshShadingMenu($parent);
  105.         return;
  106.     }
  107.  
  108.     // After the first post builds the menu, change the
  109.     // post command to refresh the menus items.
  110.     //
  111.     menu -edit
  112.         -postMenuCommand ("refreshShadingMenu " + $parent)
  113.         -postMenuCommandOnce false
  114.         $parent;
  115.  
  116.     menuItem -l "Material Attributes..."
  117.         -annotation "Material Attributes: Select Object to edit its shading attributes"
  118.         -c "ShowShadingGroupAttributeEditor";
  119.  
  120.     menuItem -d true;
  121.  
  122.     buildShaderMenus("");
  123.     
  124.     menuItem -d true;
  125.  
  126.     buildBakingMenus("");
  127.  
  128.     menuItem 
  129.         -label "Batch Bake (mental ray)" 
  130.         -annotation "Batch Bake: Bake lighting/shading to file textures or vertex data."
  131.         -command "mrBakeToTexture false false"
  132.         batchBakeItem;
  133.  
  134.         menuItem 
  135.             -optionBox true 
  136.             -label "Batch Bake Option Box"
  137.             -annotation "Batch Bake Option Box"
  138.             -command "mrBakeToTexture true false"
  139.             batchBakeOptionsItem;
  140.  
  141.     menuItem -d true;
  142.  
  143.     menuItem 
  144.         -label "Make Light Links"
  145.         -annotation "Make Light Links: Make light links between selected lights and selected objects"
  146.         -command "MakeLightLinks";
  147.  
  148.     menuItem 
  149.         -label "Break Light Links"
  150.         -annotation "Break Light Links: Break light links between selected lights and selected objects"
  151.         -command "BreakLightLinks";
  152.  
  153.     menuItem
  154.         -label "Select Objects Illuminated by Light"
  155.         -annotation "Select Objects Illuminated by Light: Select the objects illuminated by the currently selected light"
  156.         -command "SelectObjectsIlluminatedByLight"
  157.         RenLightingSelectObjectsItem;
  158.  
  159.     menuItem
  160.         -label "Select Lights Illuminating Object"
  161.         -annotation "Select Lights Illuminating Object: Select the lights illuminating the currently selected object"
  162.         -command "SelectLightsIlluminatingObject"
  163.         RenLightingSelectLightsItem;
  164.  
  165.     string $menu = `menuItem -l "Light Linking" -sm true -to true`;
  166.             menu -e -pmc ( "buildLightLinkingEdMenu " + $menu ) $menu;
  167.  
  168.     setParent -m ..;
  169.  
  170.     refreshShadingMenu($parent);
  171. }
  172.